Java Management Extensions
part 5/13 · 19.7 KB total
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Java EE 6 provides that a managed bean is a bean that is implemented by a Java class, which is called its bean class. A top-level Java class is a managed bean if it is defined to be a managed bean by any other Java EE technology specification (for example, the JavaServer Faces technology specification), or if it meets all of the following conditions:
1. It is not a non-static inner class.
2. It is a concrete class, or is annotated @Decorator.
3. It is not annotated with an EJB component-defining annotation or declared as an EJB bean class in ejb-jar.xml.
No special declaration, such as an annotation, is required to define a managed bean.
A MBean can notify the MBeanServer of its internal changes (for the attributes) by implementing the javax.management.NotificationEmitter. The application interested in the MBean's changes registers a listener (javax.management.NotificationListener) to the MBeanServer. Note that JMX does not guarantee that the listeners will receive all notifications.cite-ref-8[8]
Types
There are two basic types of MBean:
• Standard MBeans implement a business interface containing setters and getters for the attributes and the operations (i.e., methods).
• Dynamic MBeans implement the javax.management.DynamicMBean interface that provides a way to list the attributes and operations, and to get and set the attribute values.
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────